import React, {useState} from 'react';
import Toast from './Toast';
import './index.scss'

function App() {
  const [isOpen, setIsOpen] = useState(false);
  const [message, setMessage] = useState('');

  function handleClick() {
    setIsOpen(true);
    setMessage('Hello World!');
    setTimeout(() => {
      setIsOpen(false);
    }, 3000);
  }

  return (
    <div>
      <button onClick={handleClick}>Show Toast</button>
      {isOpen && <Toast message={message}/>}
    </div>
  );
}

export default App;
